package io.gitee.cofenghen.jdbctempleplus.support;

import java.util.HashMap;
import java.util.Map;

/**
 * 实体表记录
 */
public class EntityMeta {

    private String tableName; // 表名
    private  String primaryKeyFieldName;//主键

    /**
     *  获取主键
     * @return
     */
    public String getPrimaryKeyFieldName() {
        return primaryKeyFieldName;
    }

    /**
     *
     * @param primaryKeyFieldName
     */
    public void setPrimaryKeyFieldName(String primaryKeyFieldName) {
        this.primaryKeyFieldName = primaryKeyFieldName;
    }


    private Map<String, FieldMeta> fieldMetas = new HashMap<>(); // 字段元数据

    private Map<String, FieldMeta>   dataFieldMetas = new HashMap<>(); // 字段元数据

    /**
     * 获取表名
     * @return
     */
    public String getTableName() {
        return tableName;
    }

    /**
     * 赋值tableName
     * @param tableName
     */
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /**
     *  get FieldMetas
     * @return
     */
    public Map<String, FieldMeta> getFieldMetas() {
        return fieldMetas;
    }

    /**
     * 添加字段
     * @param name
     * @param fieldMeta
     */
    public void addFieldMeta(String name, FieldMeta fieldMeta) {
        this.fieldMetas.put(name, fieldMeta);
    }

    /**
     *
     * @param name
     * @return
     */
    public FieldMeta getFieldMeta(String name) {
        return fieldMetas.get(name);
    }
    public void addDataFieldMeta(String name, FieldMeta fieldMeta) {
        this.dataFieldMetas.put(name, fieldMeta);
    }

    public FieldMeta getDataFieldMeta(String name) {
        return dataFieldMetas.get(name);
    }
}
